import dateutil


def dt(isostring):
    return dateutil.parser.parse(isostring)


MOCK_NOW = dt('2016-10-10T13:02:34-07:00')


apps = [{'age': 43,
         'being_charged': None,
         'city': 'East Elizabeth, VA',
         'contact_preferences': ['prefers_sms',
                                 'prefers_voicemail',
                                 'prefers_snailmail',
                                 'prefers_email'],
         'currently_employed': True,
         'date_received': dt('2016-09-30T13:02:34Z'),
         'events': [{'applicant': 1,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 3,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-30T06:02:34-07:00')},
                    {'applicant': 1,
                     'data': {},
                     'id': 4,
                     'name': 'application_submitted',
                     'time': dt('2016-09-30T06:02:34-07:00')},
                    {'applicant': 1,
                     'data': {'counties': ['contracosta'],
                              'ip': '212.240.80.182',
                              'referrer': 'http://sfpublicdefender.org/',
                              'user_agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko'},
                     'id': 1,
                     'name': 'application_started',
                     'time': dt('2016-09-30T05:51:01.310000-07:00')},
                    {'applicant': 1,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 2,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-30T05:51:01.310000-07:00')}],
         'finished': dt('2016-09-30T06:02:34-07:00'),
         'had_errors': False,
         'id': 1,
         'ip': '212.240.80.182',
         'is_multicounty': False,
         'monthly_income': 794,
         'on_probation_parole': False,
         'organizations': [{'name': 'Contra Costa Public Defender',
                            'slug': 'cc_pubdef', 'is_live': True}],
         'referrer': 'http://sfpublicdefender.org/',
         'serving_sentence': False,
         'started': dt('2016-09-30T05:51:01.310000-07:00'),
         'submission_id': 1,
         'tried_to_apply': True,
         'url': '/application/1/',
         'us_citizen': True},
        {'age': 43,
         'being_charged': None,
         'city': 'Port Barton, HI',
         'contact_preferences': ['prefers_voicemail', 'prefers_sms', 'prefers_email'],
         'currently_employed': True,
         'date_received': dt('2016-10-06T10:18:57Z'),
         'events': [{'applicant': 2,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 7,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-06T03:18:57-07:00')},
                    {'applicant': 2,
                     'data': {},
                     'id': 8,
                     'name': 'application_submitted',
                     'time': dt('2016-10-06T03:18:57-07:00')},
                    {'applicant': 2,
                     'data': {'counties': ['contracosta'],
                              'ip': '49.199.23.6',
                              'referrer': 'http://www.safeandjust.org/county-map',
                              'user_agent': 'Mozilla/5.0 (Linux; Android 4.4.2; SM-N900T Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Mobile Safari/537.36'},
                     'id': 5,
                     'name': 'application_started',
                     'time': dt('2016-10-06T03:14:57.966000-07:00')},
                    {'applicant': 2,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 6,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-06T03:14:57.966000-07:00')}],
         'finished': dt('2016-10-06T03:18:57-07:00'),
         'had_errors': False,
         'id': 2,
         'ip': '49.199.23.6',
         'is_multicounty': False,
         'monthly_income': 5431,
         'on_probation_parole': True,
         'organizations': [{'name': 'Contra Costa Public Defender',
                            'slug': 'cc_pubdef', 'is_live': True}],
         'referrer': 'http://www.safeandjust.org/county-map',
         'serving_sentence': False,
         'started': dt('2016-10-06T03:14:57.966000-07:00'),
         'submission_id': 2,
         'tried_to_apply': True,
         'url': '/application/2/',
         'us_citizen': True},
        {'age': 50,
         'being_charged': False,
         'city': 'Roryfort, RI',
         'contact_preferences': ['prefers_voicemail', 'prefers_email', 'prefers_sms'],
         'currently_employed': None,
         'date_received': dt('2016-10-04T23:20:18Z'),
         'events': [{'applicant': 3,
                     'data': {'page_name': 'DeclarationLetterReviewPage'},
                     'id': 13,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-04T16:20:18-07:00')},
                    {'applicant': 3,
                     'data': {},
                     'id': 14,
                     'name': 'application_submitted',
                     'time': dt('2016-10-04T16:20:18-07:00')},
                    {'applicant': 3,
                     'data': {'page_name': 'DeclarationLetterView'},
                     'id': 12,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-04T16:17:19.261000-07:00')},
                    {'applicant': 3,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 11,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-04T16:13:58.101000-07:00')},
                    {'applicant': 3,
                     'data': {'counties': ['alameda'],
                              'ip': '232.104.92.173',
                              'referrer': 'http://sfpublicdefender.org/',
                              'user_agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko'},
                     'id': 9,
                     'name': 'application_started',
                     'time': dt('2016-10-04T16:11:23.471000-07:00')},
                    {'applicant': 3,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 10,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-04T16:11:23.471000-07:00')}],
         'finished': dt('2016-10-04T16:20:18-07:00'),
         'had_errors': False,
         'id': 3,
         'ip': '232.104.92.173',
         'is_multicounty': False,
         'monthly_income': 2999,
         'on_probation_parole': True,
         'organizations': [{'name': "Alameda County Public Defender's Office",
                            'slug': 'a_pubdef', 'is_live': True}],
         'referrer': 'http://sfpublicdefender.org/',
         'serving_sentence': False,
         'started': dt('2016-10-04T16:11:23.471000-07:00'),
         'submission_id': 3,
         'tried_to_apply': True,
         'url': '/application/3/',
         'us_citizen': True},
        {'age': 29,
         'being_charged': False,
         'city': 'West Kathie, MH',
         'contact_preferences': ['prefers_email'],
         'currently_employed': None,
         'date_received': dt('2016-09-28T08:53:05Z'),
         'events': [{'applicant': 4,
                     'data': {'page_name': 'DeclarationLetterReviewPage'},
                     'id': 19,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-28T01:53:05-07:00')},
                    {'applicant': 4,
                     'data': {},
                     'id': 20,
                     'name': 'application_submitted',
                     'time': dt('2016-09-28T01:53:05-07:00')},
                    {'applicant': 4,
                     'data': {'page_name': 'DeclarationLetterView'},
                     'id': 18,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-28T01:50:21.755000-07:00')},
                    {'applicant': 4,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 17,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-28T01:48:47.172000-07:00')},
                    {'applicant': 4,
                     'data': {'counties': ['alameda'],
                              'ip': '217.239.201.172',
                              'referrer': 'https://checkrapplicant.zendesk.com/hc/en-us',
                              'user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0'},
                     'id': 15,
                     'name': 'application_started',
                     'time': dt('2016-09-28T01:46:07.796000-07:00')},
                    {'applicant': 4,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 16,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-28T01:46:07.796000-07:00')}],
         'finished': dt('2016-09-28T01:53:05-07:00'),
         'had_errors': False,
         'id': 4,
         'ip': '217.239.201.172',
         'is_multicounty': False,
         'monthly_income': 2999,
         'on_probation_parole': True,
         'organizations': [{'name': "Alameda County Public Defender's Office",
                            'slug': 'a_pubdef', 'is_live': True}],
         'referrer': 'https://checkrapplicant.zendesk.com/hc/en-us',
         'serving_sentence': False,
         'started': dt('2016-09-28T01:46:07.796000-07:00'),
         'submission_id': 4,
         'tried_to_apply': True,
         'url': '/application/4/',
         'us_citizen': True},
        {'age': 44,
         'being_charged': False,
         'city': 'Watsicatown, ND',
         'contact_preferences': ['prefers_snailmail'],
         'currently_employed': None,
         'date_received': dt('2016-10-01T07:17:14Z'),
         'events': [{'applicant': 5,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 23,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-01T00:17:14-07:00')},
                    {'applicant': 5,
                     'data': {},
                     'id': 24,
                     'name': 'application_submitted',
                     'time': dt('2016-10-01T00:17:14-07:00')},
                    {'applicant': 5,
                     'data': {'counties': ['alameda'],
                              'ip': '48.67.220.52',
                              'referrer': 'https://checkrapplicant.zendesk.com/hc/en-us',
                              'user_agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1'},
                     'id': 21,
                     'name': 'application_started',
                     'time': dt('2016-10-01T00:05:15.203000-07:00')},
                    {'applicant': 5,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 22,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-01T00:05:15.203000-07:00')}],
         'finished': dt('2016-10-01T00:17:14-07:00'),
         'had_errors': False,
         'id': 5,
         'ip': '48.67.220.52',
         'is_multicounty': False,
         'monthly_income': 3001,
         'on_probation_parole': True,
         'organizations': [{'name': 'East Bay Community Law Center',
                            'slug': 'ebclc', 'is_live': True}],
         'referrer': 'https://checkrapplicant.zendesk.com/hc/en-us',
         'serving_sentence': False,
         'started': dt('2016-10-01T00:05:15.203000-07:00'),
         'submission_id': 5,
         'tried_to_apply': True,
         'url': '/application/5/',
         'us_citizen': True},
        {'age': 52,
         'being_charged': False,
         'city': 'Pearlineview, FL',
         'contact_preferences': ['prefers_snailmail',
                                 'prefers_voicemail',
                                 'prefers_sms'],
         'currently_employed': None,
         'date_received': dt('2016-10-08T14:06:04Z'),
         'events': [{'applicant': 6,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 27,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-08T07:06:04-07:00')},
                    {'applicant': 6,
                     'data': {},
                     'id': 28,
                     'name': 'application_submitted',
                     'time': dt('2016-10-08T07:06:04-07:00')},
                    {'applicant': 6,
                     'data': {'counties': ['alameda'],
                              'ip': '240.242.220.4',
                              'referrer': 'https://www.codeforamerica.org/products/clear-my-record',
                              'user_agent': 'Mozilla/5.0 (Linux; Android 4.4.4; en-us; SAMSUNG SGH-M919 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36'},
                     'id': 25,
                     'name': 'application_started',
                     'time': dt('2016-10-08T07:00:23.243000-07:00')},
                    {'applicant': 6,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 26,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-08T07:00:23.243000-07:00')}],
         'finished': dt('2016-10-08T07:06:04-07:00'),
         'had_errors': False,
         'id': 6,
         'ip': '240.242.220.4',
         'is_multicounty': False,
         'monthly_income': 3001,
         'on_probation_parole': True,
         'organizations': [{'name': 'East Bay Community Law Center',
                            'slug': 'ebclc', 'is_live': True}],
         'referrer': 'https://www.codeforamerica.org/products/clear-my-record',
         'serving_sentence': False,
         'started': dt('2016-10-08T07:00:23.243000-07:00'),
         'submission_id': 6,
         'tried_to_apply': True,
         'url': '/application/6/',
         'us_citizen': True},
        {'age': 16,
         'being_charged': False,
         'city': 'Greenfelderland, ID',
         'contact_preferences': ['prefers_voicemail'],
         'currently_employed': False,
         'date_received': dt('2016-10-07T13:49:24Z'),
         'events': [{'applicant': 7,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 31,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-07T06:49:24-07:00')},
                    {'applicant': 7,
                     'data': {},
                     'id': 32,
                     'name': 'application_submitted',
                     'time': dt('2016-10-07T06:49:24-07:00')},
                    {'applicant': 7,
                     'data': {'counties': ['sanfrancisco'],
                              'ip': '251.196.69.22',
                              'referrer': 'http://sfpublicdefender.org/services/clean-slate/',
                              'user_agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'},
                     'id': 29,
                     'name': 'application_started',
                     'time': dt('2016-10-07T06:42:13.957000-07:00')},
                    {'applicant': 7,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 30,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-07T06:42:13.957000-07:00')}],
         'finished': dt('2016-10-07T06:49:24-07:00'),
         'had_errors': False,
         'id': 7,
         'ip': '251.196.69.22',
         'is_multicounty': False,
         'monthly_income': 6229,
         'on_probation_parole': False,
         'organizations': [{'name': 'San Francisco Public Defender',
                            'slug': 'sf_pubdef', 'is_live': True}],
         'referrer': 'http://sfpublicdefender.org/services/clean-slate/',
         'serving_sentence': False,
         'started': dt('2016-10-07T06:42:13.957000-07:00'),
         'submission_id': 7,
         'tried_to_apply': True,
         'url': '/application/7/',
         'us_citizen': True},
        {'age': 29,
         'being_charged': False,
         'city': 'Estelview, CT',
         'contact_preferences': ['prefers_voicemail',
                                 'prefers_email',
                                 'prefers_sms',
                                 'prefers_snailmail'],
         'currently_employed': False,
         'date_received': dt('2016-09-30T00:09:28Z'),
         'events': [{'applicant': 8,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 35,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-29T17:09:28-07:00')},
                    {'applicant': 8,
                     'data': {},
                     'id': 36,
                     'name': 'application_submitted',
                     'time': dt('2016-09-29T17:09:28-07:00')},
                    {'applicant': 8,
                     'data': {'counties': ['sanfrancisco'],
                              'ip': '131.93.56.119',
                              'referrer': 'https://www.google.com/',
                              'user_agent': 'Mozilla/5.0 (Linux; Android 4.4.4; en-us; SAMSUNG SGH-M919 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36'},
                     'id': 33,
                     'name': 'application_started',
                     'time': dt('2016-09-29T17:03:43.126000-07:00')},
                    {'applicant': 8,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 34,
                     'name': 'application_page_complete',
                     'time': dt('2016-09-29T17:03:43.126000-07:00')}],
         'finished': dt('2016-09-29T17:09:28-07:00'),
         'had_errors': False,
         'id': 8,
         'ip': '131.93.56.119',
         'is_multicounty': False,
         'monthly_income': 6370,
         'on_probation_parole': False,
         'organizations': [{'name': 'San Francisco Public Defender',
                            'slug': 'sf_pubdef', 'is_live': True}],
         'referrer': 'https://www.google.com/',
         'serving_sentence': False,
         'started': dt('2016-09-29T17:03:43.126000-07:00'),
         'submission_id': 8,
         'tried_to_apply': True,
         'url': '/application/8/',
         'us_citizen': True},
        {'age': 54,
         'being_charged': False,
         'city': 'East Cole, ND',
         'contact_preferences': ['prefers_email'],
         'currently_employed': False,
         'date_received': dt('2016-10-06T03:24:01Z'),
         'events': [{'applicant': 9,
                     'data': {'page_name': 'DeclarationLetterReviewPage'},
                     'id': 41,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-05T20:24:01-07:00')},
                    {'applicant': 9,
                     'data': {},
                     'id': 42,
                     'name': 'application_submitted',
                     'time': dt('2016-10-05T20:24:01-07:00')},
                    {'applicant': 9,
                     'data': {'page_name': 'DeclarationLetterView'},
                     'id': 40,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-05T20:22:43.252000-07:00')},
                    {'applicant': 9,
                     'data': {'page_name': 'CountyApplication'},
                     'id': 39,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-05T20:21:24.917000-07:00')},
                    {'applicant': 9,
                     'data': {'counties': ['sanfrancisco', 'contracosta', 'alameda'],
                              'ip': '4.142.241.57',
                              'referrer': 'http://sfpublicdefender.org/services/clean-slate/',
                              'user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'},
                     'id': 37,
                     'name': 'application_started',
                     'time': dt('2016-10-05T20:19:45.265000-07:00')},
                    {'applicant': 9,
                     'data': {'page_name': 'SelectCounty'},
                     'id': 38,
                     'name': 'application_page_complete',
                     'time': dt('2016-10-05T20:19:45.265000-07:00')}],
         'finished': dt('2016-10-05T20:24:01-07:00'),
         'had_errors': False,
         'id': 9,
         'ip': '4.142.241.57',
         'is_multicounty': True,
         'monthly_income': 1373,
         'on_probation_parole': False,
         'organizations': [{'name': 'San Francisco Public Defender',
                            'slug': 'sf_pubdef', 'is_live': True},
                           {'name': 'Contra Costa Public Defender',
                               'slug': 'cc_pubdef', 'is_live': True},
                           {'name': "Alameda County Public Defender's Office", 'slug': 'a_pubdef', 'is_live': True}],
         'referrer': 'http://sfpublicdefender.org/services/clean-slate/',
         'serving_sentence': False,
         'started': dt('2016-10-05T20:19:45.265000-07:00'),
         'submission_id': 9,
         'tried_to_apply': True,
         'url': '/application/9/',
         'us_citizen': True}]
